class PartStockinDetailsController < ApplicationController
  def new
  	@part_stockin_detail = PartStockinDetail.new
    @part_styles = PartStyle.all
  end

  def create
  	@part_stockin_detail = PartStockinDetail.new post_params
    if @part_stockin_detail.save
       redirect_to part_stockin_path(:id =>@part_stockin_detail.part_stockin.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @part_stockin_detail = PartStockinDetail.find params[:id]
    @part_stockin_detail.destroy
    redirect_to part_stockin_path(:id =>@part_stockin_detail.part_stockin.id)
  end

   def post_params
    params.require(:part_stockin_detail).permit(*%w(part_stockin_id part_id qty))
  end
end
